Component({
  data: {
    selected: null,
    list: [{
        "id": 0,
        "pagePath": "/pages/home/index",
        "iconPath": "/static/image/home.png",
        "selectedIconPath": "/static/image/home_active.png",
        "text": "首页"
      },
      {
        "id": 1,
        "pagePath": "/pages/classification/index",
        "iconPath": "/static/image/class.png",
        "selectedIconPath": "/static/image/calss_active.png",
        "text": "产品分类"
      },
      {
        "id": 2,
        "pagePath": "/pages/cart/index",
        "iconPath": "/static/image/cart.png",
        "selectedIconPath": "/static/image/cart_active.png",
        "text": "购物车"
      },
      {
        "id": 3,
        "pagePath": "/pages/user/index",
        "iconPath": "/static/image/my.png",
        "selectedIconPath": "/static/image/my_active.png",
        "text": "我的"
      }
    ]
  },
  methods: {
    onChange(event) {
      wx.switchTab({
        url: this.data.list[event.detail].pagePath
      })
      this.setData({
        selected: event.detail
      });
    },
  }
})